using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableUnionFightGateDao:DaoBase<TableUnionFightGate>
    {
        public override void AddPrimaryIndex(TableUnionFightGate model)
        {
            cachePrimary[model.UFGId.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableUnionFightGate.txt";
        }

        protected override TableUnionFightGate ParseRowData(string[] rowData)
        {
            TableUnionFightGate data = new TableUnionFightGate();

            if (string.IsNullOrEmpty(rowData[0]))
            {
                data.UFGId = 0;
            }
            else
            {
                data.UFGId = int.Parse(rowData[0]);
            }

            if (string.IsNullOrEmpty(rowData[1]))
            {
                data.UFId = 0;
            }
            else
            {
                data.UFId = int.Parse(rowData[1]);
            }
			data.Position = rowData [2];

            if (string.IsNullOrEmpty(rowData[3]))
            {
                data.Camp = 0;
            }
            else
            {
                data.Camp = int.Parse(rowData[3]);
            }

            if (string.IsNullOrEmpty(rowData[4]))
            {
                data.Range = 0;
            }
            else
            {
                data.Range = double.Parse(rowData[4]);
            }
			data.GateModel = rowData [5];
			data.GateState = rowData [6];

            return data;
        }


        public override void AddOneIndex(TableUnionFightGate model)
        {
            if (!cacheOneIndex.ContainsKey(model.UFId.ToString()))
            {
                cacheOneIndex[model.UFId.ToString()] = new List<TableUnionFightGate>();
            }
            cacheOneIndex[model.UFId.ToString()].Add(model);
        }
    

    }

}
